using System;
using System.Collections.Generic;
using System.Text;

namespace FixedWidthFileViewer
{
    public class FixedWidthSchema
    {
        private List<FixedWidthField> fields;
        private bool linesEndWithLinefeed;

        public bool LinesEndWithLinefeed
        {
            get { return linesEndWithLinefeed; }
            set { linesEndWithLinefeed = value; }
        }

        public List<FixedWidthField> Fields
        {
            get { return fields; }
            set { fields = value; }
        }

        public FixedWidthSchema()
        {
            fields = new List<FixedWidthField>();
        }

        public void AddField(string name, int length)
        {
            fields.Add(new FixedWidthField(name, length));
        }

        public int GetRecordLength()
        {
            int length = 0;
            foreach (FixedWidthField field in fields)
            {
                length += field.Length;
            }

            return length;
        }
    }
}
